<?php

use think\facade\Route;

Route::rule("sms/send_code", "sms/sendCode", "POST");
Route::rule("login", "login/index", "POST");
Route::rule("category/search/:id", "category/search", "GET");
Route::rule("category", "category/index", "GET");
Route::rule("home/getRotationChart", "home/getRotationChart", "GET");
Route::rule("home/categoryGoodsRecommend", "home/categoryGoodsRecommend", "GET");
Route::rule("lists", "product/search", "GET");
Route::rule("detail/:id", "product/detail");

/**
 * 必须用户登录的路由
 */
Route::group(function (){
    Route::group("user", function (){
        Route::rule("profile", "/index", "GET");
        Route::rule("update", "/update", "PUT");
        Route::rule("init", "/init", "POST");

    })->prefix("user");

    Route::group("cart", function () {
        Route::rule("add", "/add", "POST");
        Route::rule("list", "/index", "GET");
        Route::rule("update", "/update", "POST");
        Route::rule("delete", "/delete", "POST");
    })->prefix("cart");

    Route::rule("address", "address/index", "GET");
    Route::rule("order", "order/save", "POST");
    Route::rule("order/:id", "order/detail", "GET");


    Route::rule("logout", "/logout/index", "GET");
})->middleware(\app\api\middleware\Auth::class);